<template>
    <div class="artist">
        <div class="artist_info">
            <div class="artist_img">
                <img :src="picUrl" alt="">
            </div>
            <div class="right">
                <div class="title">
                    <div class="type">歌手</div>
                    <div class="name">{{name}}</div>
                </div>
                <div class="overview">
                    <div class="songs_count iconfont  iconyinle">单曲数：{{musicSize}}</div>
                    <div class="album_count iconfont  iconzhuanjiguangpan">专辑数：{{albumSize}}</div>
                    <div class="album_count iconfont  iconshipin">MV数：{{mvSize}}</div>
                </div>
            </div>
        </div>
        <tabbar v-if="tabbarList" :tabbarList = "tabbarList" @getCurrentIndex = "getCurrentIndex" />
        <ablumCom v-if="tabbarFlag == 0 && hotSongs" :hotSongs = "hotSongs"/>
        <description v-if="tabbarFlag == 2" :description = "description"/>
        <div style="height:49px"></div>
    </div>
</template>

<script>
import {_getArtist} from '../../network/artists'
import tabbar from '../../components/common/tabbar/tabbar'
import ablumCom from '../../components/content/artist/ablumCom'
import description from '../../components/content/playList/description'
export default {
    name: 'artist',
    props: [

    ],
    data() {
        return {
            name:'',
            picUrl:'',
            musicSize:'',
            albumSize:'',
            mvSize:'',
            tabbarList:['专辑','MV','歌手详情','相似歌手'],
            tabbarFlag:0,
            hotSongs:null,
            description:'', 
        };
    },
    computed: {

    },
    created() {
        _getArtist(this.$route.query.id)
        .then(res => {
            this.hotSongs = res.data.hotSongs   
            this.name = res.data.artist.name
            this.picUrl = res.data.artist.img1v1Url
            this.description = res.data.artist.briefDesc
            this.musicSize = res.data.artist.musicSize
            this.albumSize = res.data.artist.albumSize
            this.mvSize = res.data.artist.mvSize
        })
    },
    mounted() {

    },
    watch: {

    },
    methods: {
        getCurrentIndex(index){
            this.tabbarFlag = index
        },
    },
    components: {
        tabbar,
        ablumCom,
        description,
    },
};
</script>

<style scoped lang="less">
@itemecolor:#E03F40;
@infoColor:#ccc;
@more:#666666;
@textColor:#fff;
@title:20px;
.position_flex(@jc:space-between,@ai:center){
  display: flex;
  align-items: @ai;
  justify-content: @jc;
}
.artist{
    width: 100%;
    height: calc(100vh - 49px * 2);
    background-color: #2f3640;
    overflow: auto;
    color: @textColor;
    .artist_info{
        .position_flex(flex-start,top);
        font-size: 16px;
        margin-top: 30px;
        &>div{
            margin-left: 25px;
        }
        .artist_img{
            width: 200px;
            height: 200%;
            img{
                width: 100%;
            }
        }
        .right{
            .title{
                margin-bottom: 30px;
                .position_flex(flex-start);
                .type{
                    font-size: 14px;
                    padding: 5px;
                    color: @itemecolor;
                    border: 1px solid @itemecolor
                };
                .name{
                    font-size: 24px;
                    position: relative;
                    margin-left: 10px;
                
                }
            }
            .overview{
                font-size: 12px;
                div{
                    margin-bottom: 10px
                }
            }
            
        }

    }
}
</style>
